From 5ec9c164338c46c70070c49026d58621d9362d9d Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 21 Sep 2005 09:58:15 +0000 Subject: [PATCH] Parse vcpus for VMX guest. Vcpus are passed to device model and vmx domain builder. Signed-off-by: Yan Li Signed-off-by: Xin Li --- tools/examples/xmexample.vmx | 4 ++++ tools/ioemu/vl.c | 7 +++++++ tools/libxc/xc_vmx_build.c | 4 ++++ tools/python/xen/xend/image.py | 2 +- tools/python/xen/xm/create.py | 2 +- 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/examples/xmexample.vmx b/tools/examples/xmexample.vmx index 28f34462fd..c797e6e059 100644 --- a/tools/examples/xmexample.vmx +++ b/tools/examples/xmexample.vmx @@ -26,6 +26,10 @@ memory = 128 # A name for your domain. All domains must have different names. name = "ExampleVMXDomain" +#----------------------------------------------------------------------------- +# the number of cpus guest platform has, default=1 +vcpus=1 + # Which CPU to start domain on? #cpu = -1 # leave to Xen to pick diff --git a/tools/ioemu/vl.c b/tools/ioemu/vl.c index d5d00d22d8..426205bc27 100644 --- a/tools/ioemu/vl.c +++ b/tools/ioemu/vl.c @@ -126,6 +126,7 @@ QEMUTimer *polling_timer; int vm_running; int audio_enabled = 0; int nic_pcnet = 1; +int vcpus = 1; int sb16_enabled = 1; int adlib_enabled = 1; int gus_enabled = 1; @@ -2105,6 +2106,7 @@ void help(void) "-snapshot write to temporary files instead of disk image files\n" "-m megs set virtual RAM size to megs MB [default=%d]\n" "-nographic disable graphical output and redirect serial I/Os to console\n" + "-vcpus set CPU number of guest platform\n" #ifdef CONFIG_VNC "-vnc port use vnc instead of sdl\n" "-vncport port use a different port\n" @@ -2235,6 +2237,7 @@ enum { QEMU_OPTION_hdachs, QEMU_OPTION_L, QEMU_OPTION_no_code_copy, + QEMU_OPTION_vcpus, QEMU_OPTION_pci, QEMU_OPTION_nic_pcnet, QEMU_OPTION_isa, @@ -2307,6 +2310,7 @@ const QEMUOption qemu_options[] = { { "hdachs", HAS_ARG, QEMU_OPTION_hdachs }, { "L", HAS_ARG, QEMU_OPTION_L }, { "no-code-copy", 0, QEMU_OPTION_no_code_copy }, + { "vcpus", 1, QEMU_OPTION_vcpus }, #ifdef TARGET_PPC { "prep", 0, QEMU_OPTION_prep }, { "g", 1, QEMU_OPTION_g }, @@ -2646,6 +2650,9 @@ int main(int argc, char **argv) case QEMU_OPTION_S: start_emulation = 0; break; + case QEMU_OPTION_vcpus: + vcpus = atoi(optarg); + fprintf(logfile, "qemu: the number of cpus is %d\n", vcpus); case QEMU_OPTION_pci: pci_enabled = 1; break; diff --git a/tools/libxc/xc_vmx_build.c b/tools/libxc/xc_vmx_build.c index 50284d9c3f..96f98528be 100644 --- a/tools/libxc/xc_vmx_build.c +++ b/tools/libxc/xc_vmx_build.c @@ -626,6 +626,10 @@ static int setup_guest(int xc_handle, /* Mask all upcalls... */ for ( i = 0; i < MAX_VIRT_CPUS; i++ ) shared_info->vcpu_data[i].evtchn_upcall_mask = 1; + + shared_info->n_vcpu = vcpus; + printf(" VCPUS: %d\n", shared_info->n_vcpu); + munmap(shared_info, PAGE_SIZE); /* Populate the event channel port in the shared page */ diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index e4837e27cd..30b94cd131 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -336,7 +336,7 @@ class VmxImageHandler(ImageHandler): # xm config file def parseDeviceModelArgs(self, config): dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', - 'localtime', 'serial', 'stdvga', 'isa' ] + 'localtime', 'serial', 'stdvga', 'isa', 'vcpus' ] ret = [] for a in dmargs: v = sxp.child_value(config, a) diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index 50f4cc2642..a599890053 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -496,7 +496,7 @@ def configure_vfr(opts, config, vals): def configure_vmx(opts, config_image, vals): """Create the config for VMX devices. """ - args = [ 'memmap', 'device_model', 'cdrom', + args = [ 'memmap', 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb', 'localtime', 'serial', 'macaddr', 'stdvga', 'isa', 'nographic', 'vnc', 'vncviewer', 'sdl', 'display'] for a in args: -- 2.30.2